var post = function(url, data, success, error) {
    if (null == data) {
        data = {};
    }
    var option = {};
    option.url = url;
    option.data = data;
    option.method = 'post';
    option.success = function (data) {
        if (typeof(data) == "string") {
            data = JSON.parse(data);
        }
        if (data.ret < 1) {
            if (error) {
                error(data);
            } else {
                alert(data.msg);
            }
            return;
        }
        if (success != null) {
            success(data);
        }
    };
    option.error = function (XMLHttpRequest, textStatus, errorThrown) {
        window.parent.show_stack_info('请求失败');
    }
    $.ajax(option);
}